package org.dce.screencapturer.actions.objects;

import java.awt.event.ActionEvent;

import org.dce.screencapturer.objects.ShapeObject;
import org.dce.screencapturer.objects.TextAttributes;
import org.dce.screencapturer.objects.TextAttributes.HorizontalAlignment;
import org.dce.screencapturer.util.IconFactory;

@SuppressWarnings("serial")
public class AlignTextLeftAction 
	extends TextAttributeAction {


	public AlignTextLeftAction() {
		super("categories.text", "actions.alignLeft", IconFactory.getIcon("/images/format-justify-left.png"));
	}

	@Override
	public void actionPerformed(ActionEvent e) {

		ShapeObject shapeObject = (ShapeObject) getObject();
		
		TextAttributes textAttributes = (TextAttributes)shapeObject.getTextAttributes().clone();
		
		textAttributes.setHorizontalAlignment(HorizontalAlignment.LEFT);
		
		shapeObject.setTextAttributes(textAttributes);
	}

}
